<template>
  <div>
    <el-form ref="form" :model="temp" label-width="80px" class="edit">
      <el-form-item label="产品线名 :">
        <el-input v-model="temp.name" :disabled="true"></el-input>
      </el-form-item>
      <el-form-item label="编码 :">
        <el-input v-model="temp.code" :disabled="true"></el-input>
      </el-form-item>
      <el-form-item label="是否启用 :">
        <el-switch
          class="switch"
          v-model="temp.status"
          active-color="#00A854"
          active-text="启用"
          :active-value="1"
          inactive-color="#F04134"
          inactive-text="禁用"
          :inactive-value="0"
        ></el-switch>
      </el-form-item>
      <el-form-item label="添加时间 :">
        <el-input v-model="temp.addTime" :disabled="true"></el-input>
      </el-form-item>
      <el-form-item label="具体描述 :">
        <el-input type="textarea" autosize placeholder="请输入对该产品线的描述" v-model="temp.description"></el-input>
      </el-form-item>
      <el-button type="danger" @click="conserveEdit()" class="btnConserveEdit">保存修改</el-button>
      <el-button type="success" @click="closeEdit()" class="btnCloseEdit">退出</el-button>
    </el-form>
  </div>
</template>

<script>
export default {
  name: "edit",
  props:{
    productLine: Object
  },
  data(){
    return {
      temp: null
    }
  },
  created() {
    //深拷贝
    this.temp = JSON.parse(JSON.stringify(this.productLine));
  },
  methods:{
    conserveEdit(){
      this.$emit('conserveEdit',this.temp);
    },
    closeEdit(){
      //触发自定义事件
      this.$emit('closeEdit');
    }
  }
}
</script>

<style scoped>
@import "../../../assets/css/basicdata.css";
</style>
